package com.manager.common.strategy;

import com.manager.model.SchedulingStrategy;

import java.util.HashMap;
import java.util.Map;

public class StrategyManager {

    private static Map<String, SchedulingStrategy> schedulingStrategyMap = new HashMap<String, SchedulingStrategy>();

    public static SchedulingStrategy getSchedulingStrategy(String id) {
        synchronized (schedulingStrategyMap) {
            return schedulingStrategyMap.get(id);
        }
    }

    public static void setSchedulingStrategy(String id, SchedulingStrategy schedulingStrategy) {
        synchronized (schedulingStrategyMap) {
            schedulingStrategyMap.put(id, schedulingStrategy);
        }
    }

    public static void removeSchedulingStrategy(String id) {
        synchronized (schedulingStrategyMap) {
            schedulingStrategyMap.remove(id);
        }
    }
}
